<?php
/**
 * Clears cache of usermanagement module
 * 
 * @author Konstantin Shamko <konstantin.shamko@gmail.com> 
 * @version 0.0.1
 * @copyright  Copyright (c) 2009 Konstantin Shamko
 * @category VaselinEngine
 * @package Usermanagement Module
 * @subpackage Helper
 * @license  New BSD License
 *
 */
class Helpers_Usermanagement_Cache{
	
	/**
	 * Clears all ACL cache
	 *
	 */
	public static function clearAclCache(){
		$oGroups = new Models_Usermanagement_Groups();
		$cache = Zend_Registry::get('cache');
		
		foreach($oGroups->fetchAll() as $group){
			$cache->remove('acl_'.$group->user_group_id);
			$cache->remove('acl_resources'.$group->user_group_id);
		}
	}

	/**
	 * Clears ACL cache for group
	 *
	 * @param integer $group_id
	 */
	public static function cleanAclCacheForGroup($group_id){
		$cache = Zend_Registry::get('cache');
		$cache->remove('acl_'.$group_id);
		$cache->remove('acl_resources'.$group_id);
	}
	
}